1. Field of the Invention
The present invention relates to the use of style sheets in creating a document, and more particularly, to the use of external components in an XSL style sheet.
2. Description of the Related Art
Systems"" and applications"" use of documents has become so prolific that style sheets are now often used to help manage the documents"" display. Style sheets provide greater flexibility and control over the display of a document""s content. XSL style sheets also allow the content of documents to be transformed, making them as document transformers where the resulting documents may or may not be used for display. A user may request a document and the application associated with the document will use the information contained in the style sheet to display a new document incorporating the information contained within the style sheet and the requested document.
Typically, an XSL style sheet includes the use of tags. Tags are codes that identify an element in the document, such as heading or font, for the purpose of formatting the document. For example, the tag xe2x80x9c less than BOLD greater than xe2x80x9d indicates that the text associated with this tag should appear in bold. Style sheets also, however, have become more advanced, to include a type of programming language. An example of this is an Extensible Style Language (XSL) style sheet. XSL is a declarative style sheet language specified in Extensible Markup Language (XML) which can also be used to transform XSL documents. The XSL is actually more analogous to a programming language than to a mechanism designed purely to analyze tags and display attributes.
With XML, developers may provide functionality by creating their own customized tags. For example, XML supports links that point to multiple documents, as opposed to HTML links, which can reference just one destination each.
XML documents may be served to different clients with varied interests and capabilities. For example, a PC running NETSCAPE may require a document formatted differently than a PDA would. XSL is the style language used by XML to allow different clients to receive different XML documents. XSL is a specification language for separating style from content when creating XML or HTML pages. XSL style sheets allow a single style to be applied to multiple documents.
However, there are limitations to the use of style sheets. An application utilizing a style sheet to display a document often requires that the information contained in the style sheet be application dependent. In other words, the application must be aware of all the tag definitions.
In addition, style sheets typically are not very robust and while they use a programming language, do not provide for external calls to components or libraries which may be used to aid in the modification of document information to be displayed.
Similarly, the use of XSL style sheets has been limited. Information contained within the XSL style sheet must be defined within the application and the XSL style sheet itself, and therefore the style sheet becomes application dependent. This sometimes is not desirable when using a style sheet across multiple applications, in which case a separate style sheet for each application would need to be developed. Furthermore, the XSL style sheet is completely self-contained in that no modules or functions can be called outside the style sheet itself. Therefore, what is needed in the art is the ability to create a style sheet that is application independent and to provide a means for creating application dependent functions within that style sheet.
Methods, systems and articles of manufacture consistent with the present invention overcome the shortcomings of existing style sheets by providing the ability to define components in a style sheet in order to execute methods outside the application. Using a Namespace paradigm, these components, declared within the style sheet, will be recognized by a style sheet processor.
In accordance with one aspect of the present invention, as embodied and broadly described herein, in a data processing system, a method of creating a transform document using a style sheet comprises the steps of receiving a request for an input document, retrieving the style sheet, having tags, associated with the input document, wherein one of the tags represents an external component, processing the tags, including one tag representing an external component, in the style sheet to generate a transform document, and processing a method associated with the external component. An additional step of placing the results of processing the method associated with the external component in the transform document may be performed. The method associated with the external component may generate application specific results. In addition, the style sheet may contain commands written in an XSL format. The step of processing the method associated with the external component may include loading the external component in an XSLT processor and initiating the execution of the method associated with the external component. In addition, the step of validating the style sheet and the input document may be performed. And finally, the step of locating an existing instance of the external component, wherein the processing of the one tag representing an external component includes using the existing instance, may be performed.
In accordance with another aspect of the present invention, as embodied and broadly described herein, in a data processing system, a method for executing an external component in a style sheet, comprising the steps of defining an external component to a style sheet processor, providing a definition of the external component in the style sheet, and processing the external component by the style sheet processor. The steps of loading the external component into the style sheet processor, calling the method associated with the external component defined in the style sheet, and passing an argument contained in the style sheet to the external component for use by the method may also be performed. In addition, the step of loading the external component including the step of locating an existing instance of the external component may also be performed. The external component may be defined to an XSLT processor and the style sheet using a Namespace. And, an application associated with an input document using the style sheet may not recognize the external component. Processing the external component may include executing a method associated with the external component which generates a result, and placing the result in a transform document.
In accordance with yet another aspect of the present invention, as embodied and broadly described herein, a system for processing external components in a style sheet comprises a style sheet containing a definition of an external component and a definition of a method associated with the external component, and a style sheet processor operative to receive a request for an input document, retrieve the style sheet, and call the method associated with the external component defined in the style sheet. The style sheet may contain an argument to pass to the method associated with the external component. In addition, a Namespace may be used in defining the external component to the style sheet and the style sheet processor. The style sheet processor may be an XSLT processor and the style sheet contains tags written in an XSL format. And finally, the style sheet processor may be further operative to generate a transform document and to insert a result of the call to the method associated with the external component.